package com.a2.appa3.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;


import com.SuperKotlin.pictureviewer.ImagePagerActivity;
import com.SuperKotlin.pictureviewer.PictureConfig;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.a2.appa3.R;
import com.a2.appa3.global.HttpAdress;
import com.a2.appa3.global.Info;
import com.a2.appa3.model.network.entity.req.WebSocketMsgBean;
import com.a2.appa3.ui.activity.SearchActivity;
import com.a2.appa3.util.BubbleTextVew;
import com.a2.appa3.util.OnItemClickListener;
import com.a2.appa3.util.RoundImageView;
import com.a2.appa3.util.SYSOUtils;
import com.a2.appa3.util.Timeutils;


import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


/**
 * Created by admin on 2018/12/14.
 */

public class z_palnFragmentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
        implements OnItemClickListener {
    private List<String> Picturelist;//大图预览
    Context mcontent;
    List<WebSocketMsgBean> data_one;
    private String fina2string1;
    private String fina2string2;
    private boolean qun;
    int[] huiyuan = {R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher};

    public z_palnFragmentAdapter(Context content, List<WebSocketMsgBean> dataone, Boolean qun) {
        this.mcontent = content;
        this.data_one = dataone;
        this.qun = qun;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        switch (viewType) {
            case 2:
//                SYSOUtils.sOut_("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ");
                return new MViewHolder1(LayoutInflater.from(mcontent)
                        .inflate(R.layout.msgleft, parent, false));
            case 4:
                return new MViewHolder(LayoutInflater.from(mcontent)
                        .inflate(R.layout.msgright, parent, false));
            case 22:
                return new MViewHolder5(LayoutInflater.from(mcontent)
                        .inflate(R.layout.msgleftimg, parent, false));
            case 44:
//                SYSOUtils.sOut_("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR");
                return new MViewHolder6(LayoutInflater.from(mcontent)
                        .inflate(R.layout.msgrightimg, parent, false));
//            case 8:
//                return new MViewHolder3(LayoutInflater.from(mcontent)
//                        .inflate(R.layout.msglefthongbao, parent, false));
//            case 9:
//                return new MViewHolder4(LayoutInflater.from(mcontent)
//                        .inflate(R.layout.msglefthongbaoitem, parent, false));
//            case 15:
//                return new MViewHolder7(LayoutInflater.from(mcontent)
//                        .inflate(R.layout.gengdanleft, parent, false));
        }
        return null;
    }

    @Override
    public int getItemViewType(int position) {
        if (data_one.get(position).status == 2) {
            return 2;
        } else if (data_one.get(position).status == 4) {
            return 4;
        } else if (data_one.get(position).status == 8) {
            return 8;
        } else if (data_one.get(position).status == 9) {
            return 9;
        } else if (data_one.get(position).status == 22) {
            return 22;
        } else if (data_one.get(position).status == 44) {
            return 44;
        } else if (data_one.get(position).status == 15) {
            return 15;
        } else {
            return 0;
        }
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, final int position) {
        try {
            if (viewHolder instanceof MViewHolder) {
                try {
                    MViewHolder holder = (MViewHolder) viewHolder;
                    String string = new String(Base64.decode(((String) data_one.get(position).msg).getBytes(), Base64.DEFAULT));
                    String text2 = java.net.URLDecoder.decode(string, "utf-8");
                    Pattern p_enter = Pattern.compile("</br>", Pattern.CASE_INSENSITIVE);//下面三行是将HTML中的换行符<br/>替换成"\n"
                    Matcher m_enter = p_enter.matcher(text2);
                    String text3 = m_enter.replaceAll("\n");

                    Pattern p_enter1 = Pattern.compile("<br>", Pattern.CASE_INSENSITIVE);//下面三行是将HTML中的换行符<br/>替换成"\n"
                    Matcher m_enter1 = p_enter1.matcher(text3);
                    String text4 = m_enter1.replaceAll("\n");

                    holder.contentleft.setText(text4);
                    SimpleTarget<GlideDrawable> simpleTarget = new SimpleTarget<GlideDrawable>() {
                        @Override
                        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                            holder.userimg.setImageDrawable(resource);
                        }
                    };
                    Glide.with(mcontent).load((HttpAdress.getuseAdress() + data_one.get(position).img))
                            .into(simpleTarget);
                    SYSOUtils.sOut_("TOUXIANG" + HttpAdress.getuseAdress() + data_one.get(position).img);
                    holder.huiyuan.setVisibility(View.VISIBLE);
                    switch (Integer.parseInt(data_one.get(position).level)) {
                        case 1:
                            Glide.with(mcontent).load(huiyuan[0]).asGif().into(holder.huiyuan);
                            break;
                        case 2:
                            Glide.with(mcontent).load(huiyuan[1]).asGif().into(holder.huiyuan);
                            break;
                        case 3:
                            Glide.with(mcontent).load(huiyuan[2]).asGif().into(holder.huiyuan);
                            break;
                        case 4:
                            Glide.with(mcontent).load(huiyuan[3]).asGif().into(holder.huiyuan);
                            break;
                        case 5:
                            Glide.with(mcontent).load(huiyuan[4]).asGif().into(holder.huiyuan);
                            break;
                        case 6:
                            Glide.with(mcontent).load(huiyuan[5]).asGif().into(holder.huiyuan);
                            break;
                        case 98:
                            Glide.with(mcontent).load(huiyuan[6]).asGif().into(holder.huiyuan);
                            break;
                        default:
                            holder.huiyuan.setVisibility(View.GONE);
                            break;
                    }
//                    holder.username.setText((String) data_one.get(position).fd + "");
                    holder.usertime.setText((String) data_one.get(position).times);
                    holder.contentleft.setBackGroundColor(Color.parseColor("#" + (String) data_one.get(position).bg1));
                    if (!qun && data_one.get(position).fd.equals("计划任务")) {
                        holder.itemView.setVisibility(View.GONE);
                    }
                    holder.userimg.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            if (!data_one.get(position).fd.equals(Info.user.nickname) && !data_one.get(position).fd.equals("计划任务")) {
                                Intent intent = new Intent(mcontent, SearchActivity.class);
                                intent.putExtra("username", data_one.get(position).user_id + "");
                                intent.putExtra("usertype", "users");
                                mcontent.startActivity(intent);
                            }
                        }
                    });
                } catch (Exception e) {

                }
            } else if (viewHolder instanceof MViewHolder1) {
                try {
                    MViewHolder1 holder = (MViewHolder1) viewHolder;


                    String string = new String(Base64.decode(((String) data_one.get(position).msg).getBytes(), Base64.DEFAULT));
                    String text2 = java.net.URLDecoder.decode(string, "utf-8");

                    Pattern p_enter = Pattern.compile("</br>", Pattern.CASE_INSENSITIVE);//下面三行是将HTML中的换行符<br/>替换成"\n"
                    Matcher m_enter = p_enter.matcher(text2);
                    String text3 = m_enter.replaceAll("\n");

                    Pattern p_enter1 = Pattern.compile("<br>", Pattern.CASE_INSENSITIVE);//下面三行是将HTML中的换行符<br/>替换成"\n"
                    Matcher m_enter1 = p_enter1.matcher(text3);
                    String text4 = m_enter1.replaceAll("\n");

                    holder.contentleft.setText(text4);


                    SimpleTarget<GlideDrawable> simpleTarget = new SimpleTarget<GlideDrawable>() {
                        @Override
                        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                            holder.userimg.setImageDrawable(resource);
                        }
                    };
                    Glide.with(mcontent).load((HttpAdress.getuseAdress() + data_one.get(position).img))
                            .into(simpleTarget);
                    holder.huiyuan.setVisibility(View.VISIBLE);
//                    holder.userimg.setOnClickListener(new View.OnClickListener() {
//                        @Override
//                        public void onClick(View v) {
//                            Intent intent = new Intent(mcontent, SearchActivity.class);
//                            intent.putExtra("username", data_one.get(position).user_id + "");
//                            intent.putExtra("usertype", "users");
//                            mcontent.startActivity(intent);
//                        }
//                    });
                    SYSOUtils.sOut_("TOUXIANG" + HttpAdress.getuseAdress() + data_one.get(position).img);
                    switch (Integer.parseInt(data_one.get(position).level)) {
                        case 1:
                            Glide.with(mcontent).load(huiyuan[0]).asGif().into(holder.huiyuan);
                            break;
                        case 2:
                            Glide.with(mcontent).load(huiyuan[1]).asGif().into(holder.huiyuan);
                            break;
                        case 3:
                            Glide.with(mcontent).load(huiyuan[2]).asGif().into(holder.huiyuan);
                            break;
                        case 4:
                            Glide.with(mcontent).load(huiyuan[3]).asGif().into(holder.huiyuan);
                            break;
                        case 5:
                            Glide.with(mcontent).load(huiyuan[4]).asGif().into(holder.huiyuan);
                            break;
                        case 6:
                            Glide.with(mcontent).load(huiyuan[5]).asGif().into(holder.huiyuan);
                            break;
                        case 98:
                            Glide.with(mcontent).load(huiyuan[6]).asGif().into(holder.huiyuan);
                            break;
                        default:
                            holder.huiyuan.setVisibility(View.GONE);
                            break;
                    }
//                    holder.username.setText((String) data_one.get(position).fd + "");
                    holder.usertime.setText((String) data_one.get(position).times);
                    holder.contentleft.setBackGroundColor(Color.parseColor("#" + (String) data_one.get(position).bg1));
                    if (!qun && data_one.get(position).fd.equals("计划任务")) {
                        holder.itemView.setVisibility(View.GONE);
                    }
                    holder.userimg.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            if (!data_one.get(position).fd.equals(Info.user.nickname) && !data_one.get(position).fd.equals("计划任务")) {
                                Intent intent = new Intent(mcontent, SearchActivity.class);
                                intent.putExtra("username", data_one.get(position).user_id + "");
                                intent.putExtra("usertype", "users");
                                mcontent.startActivity(intent);
                            }
                        }
                    });

                } catch (Exception e) {

                }
            } else if (viewHolder instanceof MViewHolder5) {
                try {
                    MViewHolder5 holder = (MViewHolder5) viewHolder;
                    String string = new String(Base64.decode(((String) data_one.get(position).msg).getBytes(), Base64.DEFAULT));
                    String text2 = java.net.URLDecoder.decode(string, "utf-8");
//                    Pattern p_enter = Pattern.compile("</br>", Pattern.CASE_INSENSITIVE);//下面三行是将HTML中的换行符<br/>替换成"\n"
//                    Matcher m_enter = p_enter.matcher(text2);
//                    text2 = m_enter.replaceAll("\n");
//                    holder.contentleft.setText(text2);
                    String finalstring = text2.substring(5);
                    if (finalstring.contains("&amp;data=")) {
                        fina2string1 = finalstring.replace("&amp;data=", "");
                    } else {
                        fina2string1 = finalstring.replace("&data=", "");
                    }

                    SimpleTarget<GlideDrawable> simpleTarget1 = new SimpleTarget<GlideDrawable>() {
                        @Override
                        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                            holder.contentleft.setImageDrawable(resource);
                        }
                    };
                    Glide.with(mcontent).load(HttpAdress.getuseAdress() + fina2string1)
                            .into(simpleTarget1);
                    SYSOUtils.sOut_("jia在图片" + HttpAdress.getuseAdress() + fina2string1);

                    Picturelist = new ArrayList<>();
                    holder.contentleft.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Picturelist.clear();
                            Picturelist.add(HttpAdress.getuseAdress() + fina2string1);
                            PictureConfig config = new PictureConfig.Builder()
                                    .setListData((ArrayList<String>) Picturelist)//图片数据List<String> list
                                    .setPosition(position)//图片下标（从第position张图片开始浏览）
                                    .setDownloadPath("pictureviewer")//图片下载文件夹地址
                                    .setIsShowNumber(true)//是否显示数字下标
                                    .needDownload(true)//是否支持图片下载
                                    .setPlacrHolder(R.mipmap.ic_launcher)//占位符图片
                                    .build();
                            ImagePagerActivity.startActivity(mcontent, config);
                        }
                    });

                    SimpleTarget<GlideDrawable> simpleTarget = new SimpleTarget<GlideDrawable>() {
                        @Override
                        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                            holder.userimg.setImageDrawable(resource);
                        }
                    };
                    Glide.with(mcontent).load((HttpAdress.getuseAdress() + data_one.get(position).img))
                            .into(simpleTarget);
                    holder.huiyuan.setVisibility(View.VISIBLE);
//                    holder.userimg.setOnClickListener(new View.OnClickListener() {
//                        @Override
//                        public void onClick(View v) {
//                            Intent intent = new Intent(mcontent, SearchActivity.class);
//                            intent.putExtra("username", data_one.get(position).user_id + "");
//                            intent.putExtra("usertype", "users");
//                            mcontent.startActivity(intent);
//                        }
//                    });
                    SYSOUtils.sOut_("TOUXIANG" + HttpAdress.getuseAdress() + data_one.get(position).img);
                    switch (Integer.parseInt(data_one.get(position).level)) {
                        case 1:
                            Glide.with(mcontent).load(huiyuan[0]).asGif().into(holder.huiyuan);
                            break;
                        case 2:
                            Glide.with(mcontent).load(huiyuan[1]).asGif().into(holder.huiyuan);
                            break;
                        case 3:
                            Glide.with(mcontent).load(huiyuan[2]).asGif().into(holder.huiyuan);
                            break;
                        case 4:
                            Glide.with(mcontent).load(huiyuan[3]).asGif().into(holder.huiyuan);
                            break;
                        case 5:
                            Glide.with(mcontent).load(huiyuan[4]).asGif().into(holder.huiyuan);
                            break;
                        case 6:
                            Glide.with(mcontent).load(huiyuan[5]).asGif().into(holder.huiyuan);
                            break;
                        case 98:
                            Glide.with(mcontent).load(huiyuan[6]).asGif().into(holder.huiyuan);
                            break;
                        default:
                            holder.huiyuan.setVisibility(View.GONE);
                            break;
                    }
//                    holder.username.setText((String) data_one.get(position).fd + "");
                    holder.usertime.setText((String) data_one.get(position).times);
                    if (!qun && data_one.get(position).fd.equals("计划任务")) {
                        holder.itemView.setVisibility(View.GONE);
                    }
                    holder.userimg.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            if (!data_one.get(position).fd.equals(Info.user.nickname) && !data_one.get(position).fd.equals("计划任务")) {
                                Intent intent = new Intent(mcontent, SearchActivity.class);
                                intent.putExtra("username", data_one.get(position).user_id + "");
                                intent.putExtra("usertype", "users");
                                mcontent.startActivity(intent);
                            }
                        }
                    });

                } catch (Exception e) {

                }
            } else if (viewHolder instanceof MViewHolder6) {
                try {
                    MViewHolder6 holder = (MViewHolder6) viewHolder;
                    String string = new String(Base64.decode(((String) data_one.get(position).msg).getBytes(), Base64.DEFAULT));
                    String text2 = java.net.URLDecoder.decode(string, "utf-8");
//                    Pattern p_enter = Pattern.compile("</br>", Pattern.CASE_INSENSITIVE);//下面三行是将HTML中的换行符<br/>替换成"\n"
//                    Matcher m_enter = p_enter.matcher(text2);
//                    text2 = m_enter.replaceAll("\n");
//                    holder.contentleft.setText(text2);
                    String finalstring = text2.substring(5);
                    if (finalstring.contains("&amp;data=")) {
                        fina2string2 = finalstring.replace("&amp;data=", "");
                    } else {
                        fina2string2 = finalstring.replace("&data=", "");
                    }
                    SimpleTarget<GlideDrawable> simpleTarget1 = new SimpleTarget<GlideDrawable>() {
                        @Override
                        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                            holder.contentleft.setImageDrawable(resource);
                        }
                    };
                    Glide.with(mcontent).load(HttpAdress.getuseAdress() + fina2string2)
                            .into(simpleTarget1);
                    SYSOUtils.sOut_("JIAZAIJIAZAJ加载地址1" + HttpAdress.getuseAdress() + fina2string2);
                    /**
                     * 大图
                     */
                    Picturelist = new ArrayList<>();
                    holder.contentleft.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Picturelist.clear();
                            Picturelist.add(HttpAdress.getuseAdress() + fina2string2);
                            PictureConfig config = new PictureConfig.Builder()
                                    .setListData((ArrayList<String>) Picturelist)//图片数据List<String> list
                                    .setPosition(position)//图片下标（从第position张图片开始浏览）
                                    .setDownloadPath("pictureviewer")//图片下载文件夹地址
                                    .setIsShowNumber(true)//是否显示数字下标
                                    .needDownload(true)//是否支持图片下载
                                    .setPlacrHolder(R.mipmap.ic_launcher)//占位符图片
                                    .build();
                            ImagePagerActivity.startActivity(mcontent, config);
                        }
                    });

//
                    SimpleTarget<GlideDrawable> simpleTarget = new SimpleTarget<GlideDrawable>() {
                        @Override
                        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                            holder.userimg.setImageDrawable(resource);
                        }
                    };
                    Glide.with(mcontent).load(HttpAdress.getuseAdress() + data_one.get(position).img)
                            .into(simpleTarget);
                    SYSOUtils.sOut_("头像加载地址2" + HttpAdress.getuseAdress() + data_one.get(position).img);
                    holder.huiyuan.setVisibility(View.VISIBLE);
//                    holder.userimg.setOnClickListener(new View.OnClickListener() {
//                        @Override
//                        public void onClick(View v) {
//                            Intent intent = new Intent(mcontent, SearchActivity.class);
//                            intent.putExtra("username", data_one.get(position).user_id + "");
//                            intent.putExtra("usertype", "users");
//                            mcontent.startActivity(intent);
//                        }
//                    });
                    SYSOUtils.sOut_("TOUXIANG" + HttpAdress.getuseAdress() + data_one.get(position).img);
                    switch (Integer.parseInt(data_one.get(position).level)) {
                        case 1:
                            Glide.with(mcontent).load(huiyuan[0]).asGif().into(holder.huiyuan);
                            break;
                        case 2:
                            Glide.with(mcontent).load(huiyuan[1]).asGif().into(holder.huiyuan);
                            break;
                        case 3:
                            Glide.with(mcontent).load(huiyuan[2]).asGif().into(holder.huiyuan);
                            break;
                        case 4:
                            Glide.with(mcontent).load(huiyuan[3]).asGif().into(holder.huiyuan);
                            break;
                        case 5:
                            Glide.with(mcontent).load(huiyuan[4]).asGif().into(holder.huiyuan);
                            break;
                        case 6:
                            Glide.with(mcontent).load(huiyuan[5]).asGif().into(holder.huiyuan);
                            break;
                        case 98:
                            Glide.with(mcontent).load(huiyuan[6]).asGif().into(holder.huiyuan);
                            break;
                        default:
                            holder.huiyuan.setVisibility(View.GONE);
                            break;
                    }
//                    holder.username.setText((String) data_one.get(position).fd + "");
                    holder.usertime.setText((String) data_one.get(position).times);
                    if (!qun && data_one.get(position).fd.equals("计划任务")) {
                        holder.itemView.setVisibility(View.GONE);
                    }
                    holder.userimg.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            if (!data_one.get(position).fd.equals(Info.user.nickname) && !data_one.get(position).fd.equals("计划任务")) {
                                Intent intent = new Intent(mcontent, SearchActivity.class);
                                intent.putExtra("username", data_one.get(position).user_id + "");
                                intent.putExtra("usertype", "users");
                                mcontent.startActivity(intent);
                            }
                        }
                    });

                } catch (Exception e) {

                }
            }

//            else if (viewHolder instanceof MViewHolder3) {
//                try {
//                    Intent intent = new Intent(mcontent, HongbaoDiolog.class);
//                    intent.putExtra("id", data_one.get(position).msg + "");
//                    mcontent.startActivity(intent);
//                    MViewHolder3 holder = (MViewHolder3) viewHolder;
//                    holder.item.setOnClickListener(new View.OnClickListener() {
//                        @Override
//                        public void onClick(View v) {
//                            //点击出现红包，再次点击，开始抢红包
//                            //开始请求接口 抢红包
//                            Intent intent = new Intent(mcontent, HongbaoDiolog.class);
//                            intent.putExtra("id", data_one.get(position).msg + "");
//                            mcontent.startActivity(intent);
//                        }
//                    });
//                } catch (Exception e) {
//
//                }
//            }
        } catch (Exception e) {

        }
    }

    private boolean timeclass(String times, String times1) {
        long str = Timeutils.getStringToDate(times);
        long str1 = Timeutils.getStringToDate(times1);
        int minutes = (int) ((str1 - str) / (1000 * 60));
        if (minutes > 4) {
            return true;
        }
        return false;
    }

    @Override
    public int getItemCount() {
        if (data_one == null) {
            return 0;
        } else {
            if (data_one.size() == 0) {
                return 0;
            } else {
                return data_one.size();
            }
        }
    }


    @Override
    public void onItemClick(View view, int position) {

    }

    class MViewHolder extends RecyclerView.ViewHolder {
        BubbleTextVew contentleft;
        RoundImageView userimg;
        TextView username;
        TextView usertime;
        ImageView huiyuan;

        @SuppressLint("WrongViewCast")
        MViewHolder(View itemView) {
            super(itemView);
            contentleft = itemView.findViewById(R.id.contentleft);
            userimg = itemView.findViewById(R.id.userimg);
            username = itemView.findViewById(R.id.username);
            usertime = itemView.findViewById(R.id.usertime);
            huiyuan = itemView.findViewById(R.id.huiyuan);
        }
    }

    class MViewHolder1 extends RecyclerView.ViewHolder {
        BubbleTextVew contentleft;
        RoundImageView userimg;
        TextView username;
        TextView usertime;
        ImageView huiyuan;

        @SuppressLint("WrongViewCast")
        MViewHolder1(View itemView) {
            super(itemView);
            contentleft = itemView.findViewById(R.id.contentleft);
            userimg = itemView.findViewById(R.id.userimg);
            username = itemView.findViewById(R.id.username);
            usertime = itemView.findViewById(R.id.usertime);
            huiyuan = itemView.findViewById(R.id.huiyuan);
        }
    }

//    class MViewHolder3 extends RecyclerView.ViewHolder {
//        RelativeLayout item;
//
//        MViewHolder3(View itemView) {
//            super(itemView);
//            item = itemView.findViewById(R.id.item);
//        }
//    }

    class MViewHolder4 extends RecyclerView.ViewHolder {
        TextView username;
        TextView number;

        MViewHolder4(View itemView) {
            super(itemView);
            username = itemView.findViewById(R.id.username);
            number = itemView.findViewById(R.id.number);
        }
    }

    class MViewHolder5 extends RecyclerView.ViewHolder {
        ImageView contentleft;
        RoundImageView userimg;
        TextView username;
        TextView usertime;
        ImageView huiyuan;

        MViewHolder5(View itemView) {
            super(itemView);
            contentleft = itemView.findViewById(R.id.contentleft);
            userimg = itemView.findViewById(R.id.userimg);
            username = itemView.findViewById(R.id.username);
            usertime = itemView.findViewById(R.id.usertime);
            huiyuan = itemView.findViewById(R.id.huiyuan);
        }
    }

    class MViewHolder6 extends RecyclerView.ViewHolder {
        ImageView contentleft;
        RoundImageView userimg;
        TextView username;
        TextView usertime;
        ImageView huiyuan;

        MViewHolder6(View itemView) {
            super(itemView);
            contentleft = itemView.findViewById(R.id.contentleft);
            userimg = itemView.findViewById(R.id.userimg);
            username = itemView.findViewById(R.id.username);
            usertime = itemView.findViewById(R.id.usertime);
            huiyuan = itemView.findViewById(R.id.huiyuan);
        }
    }

}
